package LeetCode;

public class LC_122_BestTimetoBuyandSellStockII {
    public static void main(String[] args) {

    }

    static class Solution {
        public int maxProfit(int[] prices) {
            int res = 0;
            for (int i = 0; i < prices.length - 1; ++i)
                if (prices[i] < prices[i + 1])
                    res += prices[i + 1] - prices[i];
            return res;
        }
    }
}
